<template>
<h1>杨硕EL_表单组件</h1>
  <el-form style="width: 500px;margin: 0 auto;" label-width="80">
    <el-form-item label="用户名">
      <el-input placeholder="请输入用户名" v-model="data.name" ></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input placeholder="请输入密码" show-password v-model="data.password"></el-input>
    </el-form-item>
    <el-form-item label="性别">
      <el-radio-group  v-model="data.gender">
        <el-radio-button label="男" value="1"></el-radio-button>
        <el-radio-button label="女" value="0"></el-radio-button>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="所在地">
      <el-select placeholder="请选择杨硕要去的城市"
                 style="width: 50%;" v-model="data.city">
        <el-option label="上海" value="sh"></el-option>
        <el-option label="北京" value="bj"></el-option>
        <el-option label="深圳" value="sz"></el-option>
        <el-option label="广州" value="gz"></el-option>
        <el-option label="杭州" value="hz"></el-option>
        <el-option label="西安" value="xa"></el-option>
        <el-option label="南京" value="nj"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="管理员">
      <el-switch
          label="管理员"
          v-model="data.isAdmin"
          class="ml-2"
          style="--el-switch-on-color: #13ce66; --el-switch-off-color: #e0e0e0"
      />
    </el-form-item>
    <el-form-item>
      <el-button type="success" @click="f">点我提交</el-button>
    </el-form-item>
  </el-form>
</template>
<script setup>
import { ref } from 'vue'
import {ElMessage} from "element-plus";
const data = ref({
  name: '',
  password: '',
  gender: '',
  city: '',
  isAdmin: ''
})
const  f= () => {
  ElMessage.success("成功消息")
  console.log(data.value)
}

</script>


<style scoped>

</style>